import type { NetItem } from '@/views/net/types'
import { assetsDB } from '@/indexDB/index'
import { ref } from 'vue'

export const netListKeys = '++id, code, baseTrigger, baseNum, baseCost, gap, holdId, totalPressure, netList'

export const netList = ref<NetItem[]>([])

export const initNetDB = async () => {
  const arr = await assetsDB.strategyList.toArray()
  if (!arr.length) {
    updateNetList()
    return
  }
}

export const updateNetList = async () => {
  netList.value = await assetsDB.netList.toArray()
}